var e = getApp();

Page({
    data: {
        phone: "",
        updateTime: "",
        citysInfo: "",
        color: "",
        main_css: "",
        back_img: "",
        richNodes: [ {
            name: "a",
            attrs: {
                class: "tel4_phone_text"
            },
            children: [ {
                type: "text",
                text: "您于前14天内到达或途经："
            } ]
        } ]
    },
    onLoad: function(t) {
        var a = JSON.parse(e.globalData.result), n = Date.parse(new Date()) + 5e3;
        wx.setStorageSync("index_data_expiration", n);
        var i, o = this.data.richNodes, s = a.message;
        i = s.indexOf(",") >= 0 ? s.split(",") : (s.indexOf("，"), s.split("，"));
        for (var r = 0; r < i.length; r++) {
            var c = "#46464C";
            0 == i[r].indexOf("<redB>") && i[r].indexOf("<redE>") > 0 && (i[r] = i[r].substr(6), 
            i[r] = i[r].substr(0, i[r].length - 6), c = "#ff0000"), 0 != r && o.push({
                name: "a",
                attrs: {
                    class: "tel4_phone1_text",
                    style: "color: #46464C;"
                },
                children: [ {
                    type: "text",
                    text: ","
                } ]
            }), o.push({
                name: "a",
                attrs: {
                    class: "tel4_phone1_text",
                    style: "color: " + c + ";"
                },
                children: [ {
                    type: "text",
                    text: i[r]
                } ]
            });
        }
        this.setData({
            phone: a.phone + "的动态行程卡",
            updateTime: "更新于：" + a.time,
            richNodes: o
        });
        var l = "main", p = "../../images/g2.png", h = new Date().getTime();
        h < 16336224e5 && h > 16318944e5 && (l = "main1", p = "../../images/happy2festival.png"), 
        this.setData({
            main_css: l,
            back_img: p
        });
    },
    onReady: function() {},
    onShow: function() {
        if (wx.getStorageSync("index_data_expiration") < Date.parse(new Date())) return console.log("缓存已过期"), 
        wx.clearStorageSync(), void wx.redirectTo({
            url: "../index"
        });
    },
    onHide: function() {},
    onUnload: function() {
        var e = getCurrentPages();
        e[e.length - 2].clear();
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            path: "pages/index"
        };
    },
    callNum: function(e) {
        var t = e.currentTarget.dataset.num;
        wx.showActionSheet({
            itemList: [ "呼叫：" + t ],
            success: function(e) {
                wx.makePhoneCall({
                    phoneNumber: t
                });
            }
        });
    },
    yztcClick: function() {
        wx.navigateTo({
            url: "/pages/webview/webview"
        });
    }
});